#
# @lc app=leetcode.cn id=118 lang=python3
#
# [118] 杨辉三角
#

# @lc code=start
class Solution:
    def generate(self, numRows: int) -> List[List[int]]:
        returnList = []
        listTemp = [1]
        for i in range(0,numRows):
            returnList.append(listTemp)
            listTemp =  self.n1Ton2(listTemp)
        
        return returnList
        
    def n1Ton2(self, listN1):
        listN2 = []
        listN2.append(listN1[0])
        
        num = len(listN1)
        
        for i in range(1, num):
            listN2.append(listN1[i]+ listN1[i-1])
        
        listN2.append(listN1[num-1])
         
        return listN2
        
# @lc code=end

